const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sp_goods_cats', {
    cat_id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "分类id"
    },
    parent_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "父级id"
    },
    cat_name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: "分类名称"
    },
    is_show: {
      type: DataTypes.TINYINT,
      allowNull: false,
      defaultValue: 1,
      comment: "是否显示"
    },
    cat_sort: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "分类排序"
    },
    data_flag: {
      type: DataTypes.TINYINT,
      allowNull: false,
      defaultValue: 1,
      comment: "数据标记"
    },
    create_time: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "创建时间"
    }
  }, {
    sequelize,
    tableName: 'sp_goods_cats',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "cat_id" },
        ]
      },
    ]
  });
};
